﻿using System;

namespace Homework
{
    class Program
    {

        public static int MathPow(int a, int b)
        {
            int res=1;
            while (b !=0 )
            {
                if (b%2 == 1)
                    res *= a;
                a *= a;
                b >>= 1;

            }
            return res;
        }


        public static double MathPow2(int a, int b)
        {
            int res = 1;
            if (b < 0)
                return 1.0/MathPow2(a, b);
            else
            {                
                for (int i = 0; i < b; i++)
                {
                    res *= a;
                   
                }
            }
            return res;

        }




        static void Main()
        {
            int a = 0;
            int b = 0;
            int c = 0;
            double result;
            string string_a = "";
            string string_b = "";
            string string_c = "";
            bool isNumber = false;
            while (!isNumber)
            {
                Console.WriteLine("Enter first number");
                try
                {
                    a = int.Parse(string_a = Console.ReadLine());
                    isNumber = true;
                }
                catch (FormatException e)
                {
                    Console.WriteLine(e.Message);
                }
            }
            isNumber = false;
            while (!isNumber)
            {
                Console.WriteLine("Enter second number");
                try
                {
                    b = int.Parse(string_b = Console.ReadLine());
                    isNumber = true;
                }
                catch (FormatException e)
                {
                    Console.WriteLine(e.Message);
                }
            }
            isNumber = false;
            while (!isNumber)
            {
                Console.WriteLine("Enter third number");
                try
                {
                    c = int.Parse(string_c = Console.ReadLine());
                    isNumber = true;
                }
                catch (FormatException e)
                {
                    Console.WriteLine(e.Message);
                }
            }
            if (a > b)
            {
                result = (a - b) / c;
                Console.WriteLine("Результат : {0}", result);
            }
            else if (b > a)
            {
                result = (b - a) / c;
                Console.WriteLine("Результат : {0}", result);
            }
            else if (b == a)
            {
                double sum = MathPow2(a, c);
                Console.WriteLine("Результат : {0}", sum);
            }
        }
    }
}
